<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all">
    <script src="../../layui/layui.js"></script>
    <script src="../../js/jquery-1.8.3.min.js"></script>
    <script src="../../js/env.js"></script>
    <title>新增区域信息</title>
</head>
<body>

<form class="layui-form" action="" style="text-align: center; margin: 100px">
    <br>
    <div class="layui-form-item">
        <label class="layui-form-label">区域名字</label>
        <div class="layui-input-block">
            <input type="text" id="areaName" name="title" lay-verify="title" autocomplete="off" placeholder="请输入区域名字" class="layui-input">
        </div>
    </div>
 <div class="layui-form-item">
    <label class="layui-form-label">区域经维度</label>
    <div class="layui-input-block">
        <input type="text" onclick="showMap()" id="latlng" name="title" lay-verify="title" autocomplete="off" placeholder="请选择区域经维度" class="layui-input">
        <input type="hidden" id="lat"  >
        <input type="hidden"   id="lng"  >
    </div>
</div>
    <button type="button" onclick="sub()" class="layui-btn layui-btn-fluid">新增</button>
</form>
</body>
<script>
    if(layui.sessionData('user').userInfo===undefined){
        window.location.href = "../html/login.html"
    }
    layui.use(['form', 'layedit', 'laydate','upload'], function() {

    });
    function sub(){
        var param={};
        param.areaName=$("#areaName").val();
        param.longitude=$("#lng").val();
        param.dimensionality=$("#lat").val();
      var response=  MyAjax("GET","/admin/config/editAreaLatLog",param,getToken());
      if(response.code===0){
          layer.msg("保存成功");
          setTimeout(function () {
              parent.layer.closeAll();
          },500)
          //表刷新方法
          var table = parent.layui.table;
          table.reload('testReload', {
              url:  abc() + '/admin/config/getAreaLatLog'
          });

      }
    }
    //弹出层
    function showMap(){
        layer.open({
            title:"鼠标点击获取经纬度",
            type: 2,
            anim: 2,
            maxmin: true,
            content: "./charg_map.html" ,//这里content是一个DOM，注意：最好该元素要存放在body最外层，否则可能被其它的相对元素所影响
            area: ['400px', '400px']
        });

    }

</script>
</html>